package ir.androidpspring;
/*
import android.app.Activity;
import android.os.Bundle;

public class FirstActivity extends Activity {
    /** Called when the activity is first created. 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}*/

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Process;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class FirstActivity extends Activity {
    /** Called when the activity is first created. */
	Intent myIntent;
	int[][] da;
	
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        /*
         * TextView tv = new TextView(this);
         * tv.setText("First Activity");
         * setContentView(tv);
         */
        setContentView(R.layout.main);
        //MyApplication.mMsg = MyApplication.mMsg.concat(",OnCreate");
        
        da = new int[1000][];
        
        Context context = getApplicationContext();
    	int duration = Toast.LENGTH_SHORT;
	    Toast toaster = Toast.makeText(context, "ON CREATE", duration);
	    toaster.show();
        
        
        final Button button = (Button) findViewById(R.id.button11);
		button.setOnClickListener(new OnClickListener() {
		    @Override
			public void onClick(View v) {
		    	//Intent 
		    	myIntent = new Intent(FirstActivity.this, SecondActivity.class);
		        FirstActivity.this.startActivity(myIntent);
		    	//createLoop();
		    }
		});       
		final Button button2 = (Button) findViewById(R.id.button12);
		button2.setOnClickListener(new OnClickListener() {
		    @Override
			public void onClick(View v) {	
		        //Intent 
		    	myIntent = new Intent(FirstActivity.this, SecondActivity.class);
		        myIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
		        FirstActivity.this.startActivity(myIntent);
		    }
		});
		final Button button3 = (Button) findViewById(R.id.button13);
		button3.setOnClickListener(new OnClickListener() {
		    @Override
			public void onClick(View v) {
		    	//Toast.makeText(FirstActivity.this, "Exiting", Toast.LENGTH_SHORT).show();
		    	finish();
		    }
		}); 
		
		final Button button4 = (Button) findViewById(R.id.button14);
		button4.setOnClickListener(new OnClickListener() {
		    @Override
			public void onClick(View v) {
		    	//Intent 
		    	myIntent = new Intent(FirstActivity.this, FirstService.class);
		    	startService(myIntent);
		    	
		    }
		});
		final Button button5 = (Button) findViewById(R.id.button15);
		button5.setOnClickListener(new OnClickListener() {
		    @Override
			public void onClick(View v) {
		    	//Intent 
		    	myIntent = new Intent(FirstActivity.this, FirstService.class);
		    	stopService(myIntent);
		    }
		});
    }
    @Override
	protected void onStart(){
    	Context context = getApplicationContext();
    	int duration = Toast.LENGTH_SHORT;
    	Toast toaster = Toast.makeText(context, "ON START", duration);
	    toaster.show();
    	super.onStart();
    }
    
    @Override
	protected void onRestart(){
    	Context context = getApplicationContext();
    	int duration = Toast.LENGTH_SHORT;
    	Toast toaster = Toast.makeText(context, "ON RESTART", duration);
	    toaster.show();
    	super.onRestart();
    }

    @Override
	protected void onResume(){
    	Context context = getApplicationContext();
    	int duration = Toast.LENGTH_SHORT;
    	Toast toaster = Toast.makeText(context, "ON RESUME", duration);
	    toaster.show();
    	super.onResume();
    }

    @Override
	protected void onPause(){
    	Context context = getApplicationContext();
    	int duration = Toast.LENGTH_SHORT;
    	Toast toaster = Toast.makeText(context, "ON PAUSE", duration);
	    toaster.show();
    	super.onPause();
    }

    @Override
	protected void onStop(){
    	Context context = getApplicationContext();
    	int duration = Toast.LENGTH_SHORT;
    	Toast toaster = Toast.makeText(context, "ON STOP", duration);
	    toaster.show();
    	super.onStop();
    }
    
    @Override
	protected void onDestroy(){
    	Context context = getApplicationContext();
    	int duration = Toast.LENGTH_SHORT;
    	Toast toaster = Toast.makeText(context, "ON DESTROY", duration);
	    toaster.show();
    	super.onDestroy();
    }
    
    public void createLoop()
	{	int x = 1000000;
		for (int i = 0; i <= 1000; i++)
		{
			int[] a = new int[x];
			da[i] = a;		
		}
	}
}

